home *** CD-ROM | disk | FTP | other *** search
/ The Programmer Disk / The Programmer Disk (Microforum).iso / xpro / c / pro22 / cbgetlck.c < prev    next >
Text File  |  1990-06-20  |  1KB  |  45 lines

  1. /*    Copyright (c) 1989 Citadel    */
  2. /*       All Rights Reserved        */
  3.  
  4. /* #ident    "@(#)cbgetlck.c    1.4 - 90/06/20" */
  5.  
  6. /* local headers */
  7. #include "cbase_.h"
  8.  
  9. /*man---------------------------------------------------------------------------
  10. NAME
  11.      cbgetlck - get cbase lock status
  12.  
  13. SYNOPSIS
  14.      #include <cbase.h>
  15.  
  16.      int cbgetlck(cbp)
  17.      cbase_t *cbp;
  18.  
  19. DESCRIPTION
  20.      The cbgetlck function reports the lock status of cbase cbp.  The
  21.      function returns the status of the lock currently held by the
  22.      calling process.  Locks held by other processes are not reported.
  23.  
  24.      The possible return values are:
  25.  
  26.      CB_UNLCK       cbase not locked
  27.      CB_RDLCK       cbase locked for reading
  28.      CB_WRLCK       cbase locked for reading and writing
  29.  
  30. SEE ALSO
  31.      cblock.
  32.  
  33. ------------------------------------------------------------------------------*/
  34. int cbgetlck(cbp)
  35. cbase_t *cbp;
  36. {
  37.     if (!(cbp->flags & CBLOCKS)) {
  38.         return CB_UNLCK;
  39.     } else if (cbp->flags & CBWRLCK) {
  40.         return CB_WRLCK;
  41.     }
  42.  
  43.     return CB_RDLCK;
  44. }
  45.